package com.blueocean_health.care.management.mapper;

import java.util.List;
import java.util.Map;
import java.util.Set;

import org.apache.ibatis.annotations.Param;

import com.blueocean_health.care.management.domain.base.RolePower;
import com.blueocean_health.care.management.domain.vo.RoleVo;
import com.blueocean_health.care.management.util.MyMapper;

public interface RolePowerMapper extends MyMapper<RolePower> {

	/**
	 * 保存角色和权限中间表信息
	 * @param roleVo
	 * @return
	 */
	int addRolePowerBase(RoleVo roleVo);

	/**
	 * 查询角色对应的模块
	 * @param roleId
	 * @return
	 */
	List<RolePower> selectByRoleId(int roleId);

	/**
	 * 根据RoleId和权限清单集合删除关系
	 * @param roleId
	 * @param removePowerSet
	 * @return
	 */
	int deleteByRoleIdAndPowerCode(@Param("roleId")int roleId, @Param("removePowerSet")Set<String> removePowerSet);

	/**
	 * 增加roleId和权限清单关系
	 * @param paramsMap
	 * @param addPowerSet
	 * @return
	 */
	int addRolePowerByRoleIdAndPowerSet(@Param("paramsMap")Map<String, Object> paramsMap, @Param("addPowerSet")Set<String> addPowerSet);

	/**
	 * 删除角色和权限清单中间表
	 * @param id
	 * @return
	 */
	int updateStatusByRoleId(Integer id);

	/**
	 * 启用禁用角色和权限清单中间表
	 * @param roleId
	 * @param status
	 * @return
	 */
	int updateRolePowerStatusByRoleId(@Param("roleId")Integer roleId, @Param("status")Integer status);

	/**
	 * 批量更新角色和权限清单状态
	 * @param roleList
	 * @param status
	 * @return
	 */
	int batchUpdateRolePowerStatus(@Param("roleList")List<RoleVo> roleList, @Param("status")String status);
}